package cn.com.nes.site.action.user;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.com.nes.common.util.ParameterUtil;
import cn.hutool.core.util.StrUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.nes.common.util.DBUtils;
import cn.com.nes.common.util.SMSUtil;
import cn.com.nes.common.util.ValidCodeUtil;
import cn.com.nes.site.entity.DataReq;
import cn.com.nes.site.entity.DataRes;
import cn.com.nes.site.entity.PageData;
import cn.com.nes.site.entity.UserInfo;
import cn.com.nes.site.entity.sms.VerCodeReq;
import cn.com.nes.site.module.service.ActiveService;
import cn.com.nes.site.module.service.UserService;
import cn.com.nes.site.module.service.crm.ClueService;

@Scope("prototype")
@Controller("active")
@RequestMapping("/active")
public class ActiveAction {

    @Resource
    private ActiveService ActiveService;
    
    @Resource
	private ClueService service_clue;
    
    @Resource
	private UserService userService;
    
    //保存模板信息
    @RequestMapping(method = RequestMethod.POST, value = "/saveActiveSession")
    public @ResponseBody
    PageData saveActiveSession(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.saveActiveSession(reqStatus.getReq());
        return res;
    }
    
    //查询模板信息
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveSession")
    public @ResponseBody
    PageData getActiveSession(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveSession(reqStatus.getReq());
        return res;
    }
    
    //删除模板信息
    @RequestMapping(method = RequestMethod.POST, value = "/delActiveSession")
    public @ResponseBody
    PageData delActiveSession(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.delActiveSession(reqStatus.getReq());
        return res;
    }
    
    //查询用户信息
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveUser")
    public @ResponseBody
    PageData getActiveUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveUser(reqStatus.getReq());
        return res;
    }
    
    //删除用户信息
    @RequestMapping(method = RequestMethod.POST, value = "/delActiveUser")
    public @ResponseBody
    PageData delActiveUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.delActiveUser(reqStatus.getReq());
        return res;
    }
    
    //查询获奖信息
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveRecord")
    public @ResponseBody
    PageData getActiveRecord(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveRecord(reqStatus.getReq());
        return res;
    }
    
    //删除获奖信息
    @RequestMapping(method = RequestMethod.POST, value = "/delActiveRecord")
    public @ResponseBody
    PageData delActiveRecord(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.delActiveRecord(reqStatus.getReq());
        return res;
    }
    
    //app-查询模板信息
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveSessionApp")
    public @ResponseBody
    PageData getActiveSessionApp(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveSessionApp(reqStatus.getReq());
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveDetails")
    public @ResponseBody
    PageData getActiveDetails(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveDetails(reqStatus.getReq());
        return res;
    }
    
    //app-查询用户基本信息
    @RequestMapping(method = RequestMethod.POST, value = "/getUserInfo")
    public @ResponseBody
    PageData getUserInfo(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getUserInfo(reqStatus.getReq());
        return res;
    }
    
    //app-查询用户抽奖次数
    @RequestMapping(method = RequestMethod.POST, value = "/getUserCjcs")
    public @ResponseBody
    PageData getUserCjcs(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getUserCjcs(reqStatus.getReq());
        return res;
    }
    
    //app-查询礼物剩余情况
    @RequestMapping(method = RequestMethod.POST, value = "/getPrizeReceive")
    public @ResponseBody
    PageData getPrizeReceive(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getPrizeReceive(reqStatus.getReq());
        return res;
    }
    
    //app-查询我的获奖信息
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveRecordApp")
    public @ResponseBody
    PageData getActiveRecordApp(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveRecordApp(reqStatus.getReq());
        return res;
    }
    
    //app-保存用户信息
    @RequestMapping(method = RequestMethod.POST, value = "/saveActiveUser")
    public @ResponseBody
    PageData saveActiveUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.saveActiveUser(reqStatus.getReq());
        return res;
    }
    
    //app-保存获奖信息
    @RequestMapping(method = RequestMethod.POST, value = "/saveAddress")
    public @ResponseBody
    PageData saveAddress(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.saveAddress(reqStatus.getReq());
        return res;
    }
    
    //app-获取验证码
  	@RequestMapping(method = RequestMethod.POST, value = "/sendValidCode")
      public @ResponseBody
      PageData getValidCode(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
          DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
          PageData res = new PageData() ;
          if (req_Status.getRetCode() != 0) {
              res = new PageData();
              res.setRetCode(req_Status.getRetCode()) ;
              res.setRetMessage(req_Status.getRetMessage());
              return res;
          }
          DataReq req = req_Status.getReq();
          String phone = (String) req.getReqData().get("phone");
          
          //验证手机号的唯一性
      		String validCode = ValidCodeUtil.generateCode(phone);
  			VerCodeReq sms = SMSUtil.sendSMS_ALIYUN_REG(phone, validCode);
  			if (sms != null)
  			{
  				userService.InsertSmsCode(sms);
  				res.setRetCode(0);
  				res.setRetMessage("获取验证码成功！");
  			}
  			else
  			{	res.setRetCode(9);
  				res.setRetMessage("获取验证码失败");
  			}
          
          
          
//          String validCode = ValidCodeUtil.generateCode(phone);
//          SMSUtil.sendSMS_ALIYUN_REG_active(phone, validCode);
//          res.setRetCode(0);
//  		  res.setRetMessage("OK");
          return res;
      }
  	
  	//--PC活动-------------------
  	
  	//PC-获取PC活动内容列表
  	@RequestMapping(method = RequestMethod.POST, value = "/getPCActiveList")
    public @ResponseBody
    PageData getPCActiveList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCActiveList(req_Status.getReq());
        return res;
    }
  	
  	//PC-获取PC活动详情
  	@RequestMapping(method = RequestMethod.POST, value = "/getPCActiveDetail")
    public @ResponseBody
    PageData getPCActiveDetail(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCActiveDetail(req_Status.getReq());
        return res;
    }
  	
  	//PC-保存PC活动
  	@RequestMapping(method = RequestMethod.POST, value = "/savePCActive")
    public @ResponseBody
    PageData savePCActive(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.savePCActive(req_Status.getReq());
        return res;
    }
  	
  	//PC-保存PC活动内定人员
  	@RequestMapping(method = RequestMethod.POST, value = "/savePCLuckyUser")
    public @ResponseBody
    PageData savePCLuckyUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.savePCLuckyUser(req_Status.getReq());
        return res;
    }

    //PC-新增流量来源
    @RequestMapping(method = RequestMethod.POST, value = "/addLy")
    public @ResponseBody
    PageData addLy(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.addLy(req_Status.getReq());
        return res;
    }

    //PC-新增奖品图片
    @RequestMapping(method = RequestMethod.POST, value = "/addTp")
    public @ResponseBody
    PageData addTp(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.addTp(req_Status.getReq());
        return res;
    }

    //查询奖品图片
    @RequestMapping(method = RequestMethod.POST, value = "/getPrizeTp")
    public @ResponseBody
    PageData getPrizeTp(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getPrizeTp(reqStatus.getReq());
        return res;
    }
  	
  	//PC-删除PC活动
  	@RequestMapping(method = RequestMethod.POST, value = "/delPCActive")
    public @ResponseBody
    PageData delPCActive(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.delPCActive(req_Status.getReq());
        return res;
    }
  	
  	//PC-获取PC活动预览内容
  	@RequestMapping(method = RequestMethod.POST, value = "/getPCActiveShow")
    public @ResponseBody
    PageData getPCActiveShow(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCActiveShow(req_Status.getReq());
        return res;
    }
  	
  	//PC-获取内定用户
  	@RequestMapping(method = RequestMethod.POST, value = "/getLuckUser")
    public @ResponseBody
    PageData getLuckUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getLuckUser(req_Status.getReq());
        return res;
    }
  	
  	//PC-获取中奖名单列表
  	@RequestMapping(method = RequestMethod.POST, value = "/getWinList")
    public @ResponseBody
    PageData getWinList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getWinList(req_Status.getReq());
        return res;
    }
  	
  	//PC-获取参与用户列表
  	@RequestMapping(method = RequestMethod.POST, value = "/getJoinUserList")
    public @ResponseBody
    PageData getJoinUserList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getJoinUserList(req_Status.getReq());
        return res;
    }
  	
  	//PC-保存中奖记录
  	@RequestMapping(method = RequestMethod.POST, value = "/savePCAwardRecord")
    public @ResponseBody
    PageData savePCAwardRecord(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.savePCAwardRecord(req_Status.getReq());
        return res;
    }
  	
  	//PC-获取落地页活动列表
  	@RequestMapping(method = RequestMethod.POST, value = "/getActivityList")
    public @ResponseBody
    PageData getActivityList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getActivityList(req_Status.getReq());
        return res;
    }
  	
  	//PC-获取参与活动总人数和地区分布
  	@RequestMapping(method = RequestMethod.POST, value = "/getActiveJoinAndArea")
    public @ResponseBody
    PageData getActiveJoinAndArea(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveJoinAndArea(req_Status.getReq());
        return res;
    }
  	
  	//PC端查询小程序助力用户
  	@RequestMapping(method = RequestMethod.POST, value = "/getCouponUser")
    public @ResponseBody
    PageData getCouponUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getCouponUser(req_Status.getReq());
        return res;
    }
  	
  	//PC端查询小程序助力记录
  	@RequestMapping(method = RequestMethod.POST, value = "/getHelpUser")
    public @ResponseBody
    PageData getHelpUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getHelpUser(req_Status.getReq());
        return res;
    }
  	
  	//小程序-根据openId查询用户信息
  	@RequestMapping(method = RequestMethod.POST, value = "/getUserInfoByOpenId")
    public @ResponseBody
    PageData getUserInfoByOpenId(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getUserInfoByOpenId(req_Status.getReq());
        return res;
    }
  	
  	//查询落地页用户信息
    @RequestMapping(method = RequestMethod.POST, value = "/getActivityUser")
    public @ResponseBody
    PageData getActivityUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActivityUser(reqStatus.getReq());
        return res;
    }
    
    //活动下拉列表
    @RequestMapping(method = RequestMethod.POST, value = "/getActivitySelect")
    public @ResponseBody
    PageData getActivitySelect(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActivitySelect(reqStatus.getReq());
        return res;
    }
    
    //小程序-保存转发记录
    @RequestMapping(method = RequestMethod.POST, value = "/saveForwardRecord")
    public @ResponseBody
    PageData saveForwardRecord(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.saveForwardRecord(reqStatus.getReq());
        return res;
    }
    
    //活动下拉列表
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveSelect")
    public @ResponseBody
    PageData getActiveSelect(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveSelect(reqStatus.getReq());
        return res;
    }
    
    //小程序-查询活动列表
    @RequestMapping(method = RequestMethod.POST, value = "/getWXActiveList")
    public @ResponseBody
    PageData getWXActiveList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getWXActiveList(reqStatus.getReq());
        return res;
    }
    
    //小程序-查询指定用户直接转发记录
    @RequestMapping(method = RequestMethod.POST, value = "/getForwardRecordForUser")
    public @ResponseBody
    PageData getForwardRecordForUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getForwardRecordForUser(reqStatus.getReq());
        return res;
    }
    
    //小程序-查询活动参与人数
    @RequestMapping(method = RequestMethod.POST, value = "/getForwardUser")
    public @ResponseBody
    PageData getForwardUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getForwardUser(reqStatus.getReq());
        return res;
    }
    
    //兑奖
    @RequestMapping(method = RequestMethod.POST, value = "/okCashPrize")
    public @ResponseBody
    PageData okCashPrize(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.okCashPrize(reqStatus.getReq());
        return res;
    }

    //兑奖-小程序
    @RequestMapping(method = RequestMethod.POST, value = "/okCashPrize_app")
    public @ResponseBody
    PageData okCashPrize_app(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.okCashPrize(reqStatus.getReq());
        return res;
    }
    
    //小程序-获取用户地址列表
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveUserAddressList")
    public @ResponseBody
    PageData getActiveUserAddressList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveUserAddressList(reqStatus.getReq());
        return res;
    }
    
    //小程序-获取用户地址详情
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveUserAddressDetail")
    public @ResponseBody
    PageData getActiveUserAddressDetail(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveUserAddressDetail(reqStatus.getReq());
        return res;
    }
    
    //小程序-保存活动用户地址
    @RequestMapping(method = RequestMethod.POST, value = "/saveActiveUserAddress")
    public @ResponseBody
    PageData saveActiveUserAddress(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.saveActiveUserAddress(reqStatus.getReq());
        return res;
    }
    
    //小程序-删除活动用户地址
    @RequestMapping(method = RequestMethod.POST, value = "/delActiveUserAddress")
    public @ResponseBody
    PageData delActiveUserAddress(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.delActiveUserAddress(reqStatus.getReq());
        return res;
    }
    
    //小程序-获取活动用户默认地址
    @RequestMapping(method = RequestMethod.POST, value = "/getActiveUserDefaultAddress")
    public @ResponseBody
    PageData getActiveUserDefaultAddress(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveUserDefaultAddress(reqStatus.getReq());
        return res;
    }
    
    //小程序-保存参与现场抽奖用户
    @RequestMapping(method = RequestMethod.POST, value = "/savePCActiveJoinUser")
    public @ResponseBody
    PageData savePCActiveJoinUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.savePCActiveJoinUser(reqStatus.getReq());
        return res;
    }
    
    @RequestMapping(method = RequestMethod.POST, value = "/savePCActiveJoinUser2023")
    public @ResponseBody
    PageData savePCActiveJoinUser2023(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.savePCActiveJoinUser2023(reqStatus.getReq());
        return res;
    }
    
    //小程序-获取自定义活动列表
    @RequestMapping(method = RequestMethod.POST, value = "/getCustomActiveList")
    public @ResponseBody
    PageData getCustomActiveList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getCustomActiveList(reqStatus.getReq());
        return res;
    }
    
    //H5查询资料所需数据字典
    @RequestMapping(method = RequestMethod.POST, value = "/getZiliaoParam")
    public @ResponseBody
    PageData getZiliaoParam(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getZiliaoParam(reqStatus.getReq());
        return res;
    }
    //H5保存客户信息
    @RequestMapping(method = RequestMethod.POST, value = "/saveCustomer")
    public @ResponseBody
    PageData saveCustomer(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.saveCustomer(reqStatus.getReq());
        return res;
    }

    //查询 签到信息 预约信息 邀请信息
    @RequestMapping(method = RequestMethod.POST, value = "/getClueByPhone")
    public @ResponseBody
    PageData getClueByPhone(HttpServletRequest request, HttpServletResponse response) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response, false);
        PageData res = new PageData();
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode());
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq();
        String cluesource = (String) req.getReqData().get("cluesource");
        if (cluesource.isEmpty()) {
            res.setRetCode(9);
            res.setRetMessage("线索来源不能为空！");
            return res;
        }
        //查询线索
        res = service_clue.getClueByPhone(req);
        return res;
    }

    //新增德尚 签到信息 42 预约信息 34 邀请信息 37
    //牛栏山煤改电  39
    //送空调买热泵  40
    //空调清洗大礼包 41
    @RequestMapping(method = RequestMethod.POST, value = "/saveCheckin")
    public @ResponseBody
    PageData saveCheckin(HttpServletRequest request, HttpServletResponse response) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response, false);
        PageData res = new PageData();
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode());
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        DataReq req = req_Status.getReq();
        //线索id不能为空
        String cluesource = (String) req.getReqData().get("cluesource");
        if (cluesource.isEmpty()) {
            res.setRetCode(9);
            res.setRetMessage("线索来源不能为空！");
            return res;
        }
        //插入线索
        req.getReqData().put("exists", "1");
        PageData restmp = service_clue.getClueByPhone(req);
        if (restmp.getPage().isEmpty()) {
            String userId="131";
            String userCompany="";
            String cluebelongtocompany="";
            List<Map<String,String>> paramDataList = ActiveService.getParamData("13", cluesource);
            if (paramDataList !=null && paramDataList.size()>0 ){
                String companyId = paramDataList.get(0).get("companyId");
                if (StringUtils.isNotEmpty(companyId)){
                    userCompany= companyId;
                    cluebelongtocompany= companyId;
                }else {
                    userCompany="0000";
                    if("29".equals(cluesource)){//李燕商城
                        cluebelongtocompany="0055";
                    }else {
                        cluebelongtocompany="0000";
                    }

                }
            }
            UserInfo uinfo = new UserInfo();
            uinfo.setId(userId);
            uinfo.setCompanyId(userCompany);
            req.setUinfo(uinfo);
            String advertisementId="";
            PageData activitySelect = ActiveService.getActivitySelect(req);
            if (activitySelect.getPage().size() >0){
                advertisementId = (String) activitySelect.getPage().get(0).get("value");
            }
            String remark = ParameterUtil.getString(req, "desc");
            req.getReqData().put("isAddCustomer", false);    //是否向客户表插入数据
            req.getReqData().put("uuid", null);
            req.getReqData().put("cluestage", "01"); //线索阶段
            req.getReqData().put("followupstatus", "01"); //跟进状态
            req.getReqData().put("poolentrymode", "05"); //入池方式
            req.getReqData().put("cluesource", cluesource);//线索流量来源 33签到34预约
            req.getReqData().put("advertisementId",advertisementId) ;//流量来源关联广告id
            req.getReqData().put("culestate", "02"); //线索状态，新线索
//          req.getReqData().put("clueowner", "") ; //线索所有人
            req.getReqData().put("cluename", req.getReqData().get("userName"));//线索名称
            req.getReqData().put("cluecompany", req.getReqData().get("userDwmc"));//企业名称
            req.getReqData().put("companycontact", req.getReqData().get("userName"));//企业联系人
            req.getReqData().put("cluephone", req.getReqData().get("userPhone"));//联系人电话
            req.getReqData().put("companyMemo", remark);//预约时间+备注
            req.getReqData().put("pooltype", "其他");//企业身份
            req.getReqData().put("personpost", "其他");//联系人职务
            req.getReqData().put("businessdirection", "设备");//业务方向
            req.getReqData().put("sex",req.getReqData().get("userSex")) ;
//          req.getReqData().put("xzqhdm",companyInfoMap.get("areacode")) ;
//          req.getReqData().put("longitude",companyInfoMap.get("longitude")) ;
//          req.getReqData().put("latitude",companyInfoMap.get("latitude")) ;
            req.getReqData().put("openid", req.getReqData().get("openId")) ;
            req.getReqData().put("unionid", req.getReqData().get("unionid")) ;
            req.getReqData().put("cluebelongtocompany", cluebelongtocompany);//线索所属公司 德尚
            req.getReqData().put("customeraddress", req.getReqData().get("userXxdz"));//客户所在地
            req.getReqData().put("isLog", "0");
            req.getReqData().put("newshopBookingId", req.getReqData().get("newshopBookingId")) ;
            res = service_clue.addClue(req);
        }else {
            res.setRetCode(9);
            res.setRetMessage("您已申请，请勿重复填写！");
        }
        return res;
    }

    /**
     * 根据unionid查询用户预约信息
     * @param request
     * @param response
     * @return
     * @throws Exception
     */
    @RequestMapping(method = RequestMethod.POST, value = "/getCheckin")
    @ResponseBody
    public PageData getCheckin(HttpServletRequest request,HttpServletResponse response) throws Exception {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = service_clue.getCheckin(reqStatus.getReq());
        return res;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/cancelCheckin")
    @ResponseBody
    public PageData cancelCheckin(HttpServletRequest request,HttpServletResponse response) throws Exception {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = service_clue.cancelCheckin(reqStatus.getReq());
        return res;
    }


    //商城优惠卷列表
    @RequestMapping(method = RequestMethod.POST, value = "/getShopList")
    public @ResponseBody
    PageData getShopList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getShopList(reqStatus.getReq());
        return res;
    }

    //根据产品id查询优惠卷id
    @RequestMapping(method = RequestMethod.POST, value = "/getProductIdByCouponId")
    public @ResponseBody
    PageData getProductIdByCouponId(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getProductIdByCouponId(reqStatus.getReq());
        return res;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/getJpAndSaveRecord")
    public @ResponseBody
    PageData getJpAndSaveRecord(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getJpAndSaveRecord(reqStatus.getReq());

        //参与活动时插入线索
        DataReq req = reqStatus.getReq() ;
        if(res.getRetCode()==0) {
            PageData restmp = service_clue.getClueByID(req) ;
            if(restmp.getRetCode()==0) {
                UserInfo uinfo = new UserInfo();
                uinfo.setId("131");
                uinfo.setCompanyId((String)req.getReqData().get("companyId"));
                req.setUinfo(uinfo );

                req.getReqData().put("isLog", "0") ;
                req.getReqData().put("followupstatus", "01") ; //跟进状态
                req.getReqData().put("poolentrymode", "05") ; //线索池
                req.getReqData().put("culestate", "02") ; //线索状态，新线索
                req.getReqData().put("cluestage", "01") ; //跟进状态
                req.getReqData().put("cluesource", req.getReqData().get("cluesource")) ;
                req.getReqData().put("pooltype", "其他") ;
                req.getReqData().put("openid", req.getReqData().get("openId")) ;
                req.getReqData().put("xzqhdm","86") ;
                req.getReqData().put("advertisementId",req.getReqData().get("activeUuid")) ;
                req.getReqData().put("cluename", req.getReqData().get("userName")) ;
                req.getReqData().put("cluebelongtocompany", req.getReqData().get("companyId")) ;
                req.getReqData().put("companycontact",req.getReqData().get("userName")) ;
                req.getReqData().put("cluephone",req.getReqData().get("userPhone") ) ;
                req.getReqData().put("projectaddress",null) ;
                req.getReqData().put("numberhome", "") ;
                req.getReqData().put("uuid",null) ;
                service_clue.addClue(req) ;
            }
        }

        return res;
    }

    //保存用户菜单---APP
    @RequestMapping(method = RequestMethod.POST, value = "/saveUserModel")
    public @ResponseBody
    PageData saveUserModel(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.saveUserModel(reqStatus.getReq());
        return res;
    }

    //查询用户菜单---APP
    @RequestMapping(method = RequestMethod.POST, value = "/getUserModel")
    public @ResponseBody
    PageData getUserModel(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getUserModel(reqStatus.getReq());
        return res;
    }

    //复制模板信息
    @RequestMapping(method = RequestMethod.POST, value = "/copyActiveSession")
    public @ResponseBody
    PageData copyActiveSession(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, true);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.copyActiveSession(reqStatus.getReq());
        return res;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/getWchatMenu")
    public @ResponseBody
    PageData getWchatMenu(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.getWchatMenu(reqStatus.getReq());
        return res;
    }

    //获取PC-WCHAT活动列表
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATActiveList")
    public @ResponseBody
    PageData getPCWCHATActiveList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATActiveList(req_Status.getReq());
        return res;
    }

    //删除PC-WCHATA活动
    @RequestMapping(method = RequestMethod.POST, value = "/delPCWCHATActive")
    public @ResponseBody
    PageData delPCWCHATActive(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.delPCWCHATActive(req_Status.getReq());
        return res;
    }

    //获取PC-WCHATA中奖名单列表
    @RequestMapping(method = RequestMethod.POST, value = "/getYaoyiyaoWinList")
    public @ResponseBody
    PageData getYaoyiyaoWinList(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getYaoyiyaoWinList(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT活动详细信息
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATActiveDetail")
    public @ResponseBody
    PageData getPCWCHATActiveDetail(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATActiveDetail(req_Status.getReq());
        return res;
    }

    //保存PC-WCHAT活动
    @RequestMapping(method = RequestMethod.POST, value = "/savePCWCHATActive")
    public @ResponseBody
    PageData savePCWCHATActive(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.savePCWCHATActive(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT活动预览内容
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATActiveShow")
    public @ResponseBody
    PageData getPCWCHATActiveShow(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATActiveShow(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT活动预览内容
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATActiveShow_xcx")
    public @ResponseBody
    PageData getPCWCHATActiveShow_xcx(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATActiveShow_xcx(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT活动预览内容
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATPersonShow")
    public @ResponseBody
    PageData getPCWCHATPersonShow(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATPersonShow(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT查询单位时间用户摇晃次数
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATTimeShake")
    public @ResponseBody
    PageData getPCWCHATTimeShake(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATTimeShake(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT排行榜保存
    @RequestMapping(method = RequestMethod.POST, value = "/savePCWCHATChartShake")
    public @ResponseBody
    PageData savePCWCHATChartShake(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.savePCWCHATChartShake(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT查询排行榜
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATChartShake")
    public @ResponseBody
    PageData getPCWCHATChartShake(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATChartShake(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT查询排行榜
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATChartShake_xcx")
    public @ResponseBody
    PageData getPCWCHATChartShake_xcx(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATChartShake_xcx(req_Status.getReq());
        return res;
    }

    //保存PC-WCHAT用户信息
    @RequestMapping(method = RequestMethod.POST, value = "/savePCWCHATActiveUser")
    public @ResponseBody
    PageData savePCWCHATActiveUser(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws SQLException {
        DataRes reqStatus = DBUtils.setRemoteVisit(request, response, false);
        PageData res;
        if (reqStatus.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(reqStatus.getRetCode());
            res.setRetMessage(reqStatus.getRetMessage());
            return res;
        }
        res = ActiveService.savePCWCHATActiveUser(reqStatus.getReq());
        //参与活动时插入线索
        DataReq req = reqStatus.getReq() ;
        if(res.getRetCode()==0) {
            PageData restmp = service_clue.getClueByID(req) ;
            if(restmp.getRetCode()==0) {
                UserInfo uinfo = new UserInfo();
                uinfo.setId("131");
                uinfo.setCompanyId((String)req.getReqData().get("companyId"));
                req.setUinfo(uinfo );
                req.getReqData().put("isLog", "0") ;
                req.getReqData().put("followupstatus", "01") ; //跟进状态
                req.getReqData().put("poolentrymode", "05") ; //线索池
                req.getReqData().put("culestate", "02") ; //线索状态，新线索
                req.getReqData().put("cluestage", "01") ; //跟进状态
                req.getReqData().put("pooltype", "其他") ;
                req.getReqData().put("xzqhdm","86") ;
                req.getReqData().put("openid", req.getReqData().get("openId")) ;
                req.getReqData().put("cluesource", req.getReqData().get("cluesource")) ;
                req.getReqData().put("advertisementId",req.getReqData().get("activeUuid")) ;
                req.getReqData().put("cluebelongtocompany", req.getReqData().get("companyId")) ;
                req.getReqData().put("companycontact",req.getReqData().get("companycontact")) ;
                req.getReqData().put("cluecompany", req.getReqData().get("cluecompany")) ;
                req.getReqData().put("businessdirection", req.getReqData().get("businessdirection")) ;
                req.getReqData().put("sex", req.getReqData().get("sex")) ;
                req.getReqData().put("address", req.getReqData().get("address")) ;
                req.getReqData().put("cluename", req.getReqData().get("companycontact")) ;
                req.getReqData().put("cluephone",req.getReqData().get("phone") ) ;
                req.getReqData().put("projectaddress",null) ;
                req.getReqData().put("numberhome", "") ;
                req.getReqData().put("uuid",null) ;
                service_clue.addClue(req) ;
            }
        }
        return res;
    }

    //保存PC-WCHAT单位时间摇晃次数
    @RequestMapping(method = RequestMethod.POST, value = "/savePCWCHATAShake")
    public @ResponseBody
    PageData savePCWCHATAShake(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.savePCWCHATAShake(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT查询用户是否获奖
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATUserhj")
    public @ResponseBody
    PageData getPCWCHATUserhj(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATUserhj(req_Status.getReq());
        return res;
    }

    //获取PC-WCHAT查询用户头像
    @RequestMapping(method = RequestMethod.POST, value = "/getPCWCHATUserimg")
    public @ResponseBody
    PageData getPCWCHATUserimg(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getPCWCHATUserimg(req_Status.getReq());
        return res;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/saveActiveIsStart")
    public @ResponseBody
    PageData saveActiveIsStart(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,true);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.saveActiveIsStart(req_Status.getReq());
        return res;
    }

    @RequestMapping(method = RequestMethod.POST, value = "/getActiveIsStart")
    public @ResponseBody
    PageData getActiveIsStart(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.getActiveIsStart(req_Status.getReq());
        return res;
    }

    //根据商城端优惠卷插入记录id修改优惠卷使用状态
    @RequestMapping(method = RequestMethod.POST, value = "/modifyState")
    public @ResponseBody
    PageData modifyState(HttpServletRequest request,HttpServletResponse response, ModelMap modelMap) throws Exception {
        DataRes req_Status = DBUtils.setRemoteVisit(request, response,false);
        PageData res = new PageData() ;
        if (req_Status.getRetCode() != 0) {
            res = new PageData();
            res.setRetCode(req_Status.getRetCode()) ;
            res.setRetMessage(req_Status.getRetMessage());
            return res;
        }
        res = ActiveService.modifyState(req_Status.getReq());
        return res;
    }

}
